<script type="text/javascript">
    function upload_success(file, data) {
        var json = $.parseJSON(data)

        $(this).bjuiajax('ajaxDone', json)
        if (json[BJUI.keys.statusCode] == BJUI.statusCode.ok) {
            $('#j_path').val(json.newName).trigger('validate');
            $('#j_name').val(json.originalName).trigger('validate');
            $('#j_size').val(json.size).trigger('validate');
//            $('#j_custom_span_pic').html('<img src="'+ json.filename +'" width="100" />')
        }
        else
        {
            $(this).alertmsg('error', error.msg)
        }
    }
</script>
<div class="bjui-pageContent">
    <form action="${wwwroot}/admin/artifact/save" id="editForm" data-toggle="validate" data-alertmsg="false" reloadNavtab="true">
        <input type="hidden" name="id" value="${(artifact.id)!}" />
        <div class="pageFormContent" data-layout-h="0">
            <table class="table table-condensed table-hover" width="100%">
                <tbody>
                    <tr>
                        <td>
                            <label for="artType" class="control-label x85">构件类型：</label>
                            <input type="text" name="artType" id="artType" value="${(artifact.artType)!}" data-rule="required" >
                        </td>
                        <td>
                            <label for="name" class="control-label x85">名称：</label>
                            <input type="text" name="name" id="j_name" value="${(artifact.name)!}" data-rule="required" >
                        </td>

                        <#--<td>-->
                            <#--<label for="path" class="control-label x85">路径：</label>-->
                            <#--<input type="text" name="path" id="path" value="${(artifact.path)!}" data-rule="required" >-->
                        <#--</td>-->
                        <td>
                            <label class="control-label x85">路径：</label>
                            <div style="display: inline-block; vertical-align: middle;">
                                <div id="j_file_up" data-toggle="upload" data-uploader="${wwwroot}/admin/artifact/upload"
                                     data-file-size-limit="1024000000"
                                     data-file-type-exts="*.sql;*.jpg"
                                     data-multi="true"
                                     data-on-upload-success="upload_success"
                                     data-icon="cloud-upload"></div>
                                <input type="hidden" name="path" value="" id="j_path">
                                <#--<span id="j_custom_span_pic"></span>-->
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="sizeLength" class="control-label x85">文件大小：</label>
                            <input type="text" name="sizeLength" id="j_size" value="${(artifact.sizeLength)!}" data-rule="required" >
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </form>
</div>
<div class="bjui-pageFooter" >
    <ul>
        <li><button type="button" class="btn btn-close" data-icon="close">取消</button></li>
        <li><button type="submit" class="btn btn-success" data-icon="save">保存</button></li>
    </ul>
</div>
